package com.jlcindia.hibernate;

import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Table;

import org.hibernate.annotations.CollectionOfElements;
import org.hibernate.annotations.IndexColumn;

@Entity
@Table(name="students")
public class Student 
{
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="sid")
	int sid;
	@Column(name="sname")
	String sname;
	@Column(name="qualification")
	String qualification;
	@Column(name="dob")
	String dob;
	@ElementCollection
	@JoinTable(name="cources", joinColumns=@JoinColumn(name="sid"))
	@IndexColumn(name = "idx")
	@Column(name="cources")
	String[] cources;
	@ElementCollection
	@JoinTable(name="email", joinColumns=@JoinColumn(name="sid"))
	@IndexColumn(name = "idx")
	@Column(name="emailId")
	List<String> emails;
	@ElementCollection
	@JoinTable(name="marks", joinColumns=@JoinColumn(name="sid"))
	@IndexColumn(name = "idx")
	@Column(name="marks")
	List<Integer> marks;
	@ElementCollection
	@JoinTable(name="phones", joinColumns=@JoinColumn(name="sid"))
	@Column(name="phoneNo")
	Set<Long> phones;
	@ElementCollection
	@JoinTable(name="refs", joinColumns=@JoinColumn(name="sid"))
	@Column(name="rphone")
	Map<String, Long> refs;
	
	public Student(){}

	public Student(String sname, String dob, String qualification,
			String[] cous, List<String> ems, List<Integer> maks, Set<Long> phs,
			Map<String, Long> refs2) {
		this.sname=sname;
		this.dob=dob;
		this.qualification=qualification;
		this.cources=cous;
		this.emails=ems;
		this.marks=maks;
		this.phones=phs;
		this.refs=refs2;
	}

	public int getSid() {
		return sid;
	}

	public void setSid(int sid) {
		this.sid = sid;
	}

	public String getSname() {
		return sname;
	}

	public void setSname(String sname) {
		this.sname = sname;
	}

	public String getQualification() {
		return qualification;
	}

	public void setQualification(String qualification) {
		this.qualification = qualification;
	}

	public String getDob() {
		return dob;
	}

	public void setDob(String dob) {
		this.dob = dob;
	}

	public String[] getCources() {
		return cources;
	}

	public void setCources(String[] cources) {
		this.cources = cources;
	}

	public List<String> getEmails() {
		return emails;
	}

	public void setEmails(List<String> emails) {
		this.emails = emails;
	}

	public List<Integer> getMarks() {
		return marks;
	}

	public void setMarks(List<Integer> marks) {
		this.marks = marks;
	}

	public Set<Long> getPhones() {
		return phones;
	}

	public void setPhones(Set<Long> phones) {
		this.phones = phones;
	}

	public Map<String, Long> getRefs() {
		return refs;
	}

	public void setRefs(Map<String, Long> refs) {
		this.refs = refs;
	}

	
	
}
